# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Maintainer: Carlo Landmeter <clandmeter@alpinelinux.org>
pkgname=lxc-templates-legacy
pkgver=3.0.3
pkgrel=0
pkgdesc="Legacy LXC container templates"
url="https://linuxcontainers.org"
arch="noarch"
license="LGPL-2.1"
depends="bash tar"
subpackages="$pkgname-alpine"
source="https://linuxcontainers.org/downloads/lxc/lxc-templates-$pkgver.tar.gz"
builddir="$srcdir/lxc-templates-$pkgver"

build() {
	cd "$builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var
	make
}

check() {
	cd "$builddir"
	make check
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install
}

alpine() {
	pkgdesc="$pkgdesc (for Alpine)"
	depends=
	mkdir -p "$subpkgdir"/usr/share/lxc/templates \
		"$subpkgdir"/usr/share/lxc/config
	local i; for i in templates/lxc-alpine config/alpine.userns.conf \
		config/alpine.common.conf; do
		mv $pkgdir/usr/share/lxc/$i "$subpkgdir"/usr/share/lxc/${i%/*}/
	done
}

sha512sums="3e9d5304f5e06580eeb766570ddfebb0c80061c2d7e47c9ea37d834fe0cf4fabe7eedd667e4937df3f2451bc3e7aa1e98a1b386f3b19964dc218ff0e21011632  lxc-templates-3.0.3.tar.gz"
